package org.hawk.gwtppc.webtest.tests.classsuite;

import java.lang.reflect.Modifier;

import org.hawk.gwtppc.webtest.common.Asserts;
import org.hawk.gwtppc.webtest.common.Test;
import org.hawk.gwtppc.webtest.tests.mock.ClassMock;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock1;

public class GetDeclaredFieldsTest implements Test {

	public void run() throws Throwable {
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields().length, 4);
		
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[0].getName(), "serialVersionUID");
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[0].getModifiers(), Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL);
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[0].getType(), long.class);
		
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[1].getName(), "staticString");
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[1].getModifiers(), Modifier.PRIVATE | Modifier.STATIC);
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[1].getType(), String.class);
		
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[2].getName(), "parent");
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[2].getModifiers(), Modifier.PROTECTED);
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[2].getType(), ClassMock.class);
		
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[3].getName(), "flag");
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[3].getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock1.class.getDeclaredFields()[3].getType(), boolean.class);
	}

	public String getName() {
		return "getDeclaredFields()";
	}

}
